<?php
require_once('../connection.php');

if(isset($_GET['requests']))
{
	$sql = 'SELECT * FROM `requests`';
	$sth = $db->prepare($sql);
	$sth->execute();
	$res = $sth->fetchAll();
	echo json_encode($res);	
}
elseif(isset($_GET['userid']))
{
	$sql = 'SELECT * FROM `requests` WHERE uid = :userid';
	$sth = $db->prepare($sql);
	$sth->bindParam(":userid",$_GET['userid']);
	$sth->execute();
	$res = $sth->fetchAll();
	echo json_encode($res);
}



?>